clear
clc
close all

plotThings = 0;

data.boot.soleLength = 30e-2;
data.binding.model = 'bulldog';
data.binding.pivotPosition = 2;

a0 = [0.+1e-6;0.]; % initial toe and bellows angle
options.a = 0; %set dummy options set


% Fhs = linspace(0,6.5,30);
% Fhs = [Fhs,linspace(6.6,12,100)];
Fhs = linspace(0,50,300); %vector of heel lift forces
% Fhs = linspace(0,20,100)

if plotThings
    hh = figure;
    axis equal
    grid on
    disp('adjust boot visualization plot for viewing during sim, then hit enter')
    pause
end

alphaN = a0;
for i = 1:length(Fhs)
    
    [alphaN,sigM] = dampedNewton(@basicBoot,alphaN,options,Fhs(i),data);
    
%     Fhs(i)
    
     [~,~,~,Fh_torque(i),rotation(i)] = basicBoot(alphaN,Fhs(i),data);
     
     aNs(:,i) = alphaN;
     
     if plotThings
         clf
        axis equal
        grid on
         plotBindingPosition(data,alphaN,hh,'b')
         tstring = ['[FhL,alpha-toe (deg),alpha-bellows (deg)]=[',num2str(Fhs(i),'%2.3g'),' , ',...
             num2str(alphaN(1)*180/pi,'%2.3g'),' , ',num2str(alphaN(2)*180/pi,'%2.3g'),']'];
         title(tstring)
     
     
        pause(.01)
        
     end
end

rotation = rotation*180/pi;

figure
plot(rotation,-Fh_torque)
xlabel('Heel rotation angle')
ylabel('Heel lift torque')
grid on